package org.jeecg.modules.staff.order.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.lettuce.core.dynamic.annotation.Param;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.home.monitoring.entity.MonitoringMap;
import org.jeecg.modules.home.monitoring.service.MonitoringService;
import org.jeecg.modules.param.area.entity.BikeSysUserArea;
import org.jeecg.modules.param.area.service.IBikeSysUserAreaService;
import org.jeecg.modules.param.station.entity.BikeStation;
import org.jeecg.modules.staff.order.dto.StationReq;
import org.jeecg.modules.staff.order.entity.ClockReq;
import org.jeecg.modules.staff.order.entity.ScanCodeReq;
import org.jeecg.modules.work.sweep.dto.WorkReq;
import org.jeecg.modules.staff.order.service.OrderService;
import org.jeecg.modules.utils.BikeResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Api(tags="工单")
@RestController
@RequestMapping("/staff/order")
@Slf4j
public class OrderController {

    @Autowired
    private OrderService orderService;


    @ApiOperation(value="我的任务单", notes="我的任务单")
    @RequestMapping(value = "/getOrderList", method = RequestMethod.GET)
    public BikeResult getOrderList(@RequestParam("pageNum") Integer pageNum,@RequestParam("pageSize") Integer pageSize, HttpServletRequest request) {
        return orderService.getOrderList(pageNum,pageSize,request);
    }

    @ApiOperation(value="查询工单任务", notes="查询工单任务")
    @RequestMapping(value = "/getWorkOrderList", method = RequestMethod.POST)
    public BikeResult getWorkOrderList(@RequestBody WorkReq workReq, HttpServletRequest request) {
        return orderService.getWorkOrderList(workReq,request);
    }

    @ApiOperation(value="打卡", notes="打卡")
    @RequestMapping(value = "/repairPunchClock", method = RequestMethod.POST)
    public BikeResult repairPunchClock(@RequestBody ClockReq clockReq, HttpServletRequest request) {
        return orderService.repairPunchClock(clockReq,request);
    }

    @ApiOperation(value="扫码打卡", notes="扫码打卡")
    @RequestMapping(value = "/cleaningPunchClock", method = RequestMethod.POST)
    public BikeResult cleaningPunchClock(@RequestBody ScanCodeReq scanCodeReq, HttpServletRequest request) {
        return orderService.cleaningPunchClock(scanCodeReq,request);
    }
    @ApiOperation(value="保洁签到打卡", notes="保洁签到打卡")
    @RequestMapping(value = "/cleaningSignInClock", method = RequestMethod.POST)
    public BikeResult cleaningSignInClock(@RequestBody ScanCodeReq scanCodeReq, HttpServletRequest request) {
        return orderService.cleaningSignInClock(scanCodeReq,request);
    }
    @ApiOperation(value="开关锁详情", notes="开关锁详情")
    @RequestMapping(value = "/switchLock", method = RequestMethod.GET)
    public BikeResult switchLock(@RequestParam(value = "pageNum")Integer pageNum,@RequestParam(value = "pageSize")Integer pageSize, HttpServletRequest request) {
        return orderService.switchLock(pageNum,pageSize,request);
    }

    @ApiOperation(value="区域获取站点", notes="区域获取站点")
    @RequestMapping(value = "/getByStationList", method = RequestMethod.GET)
    public BikeResult getByStationList(@RequestParam(value = "areId",required = false)String areId, HttpServletRequest request) {
        return orderService.getByStationList(areId,request);
    }

    @ApiOperation(value="获取车桩", notes="获取车桩")
    @RequestMapping(value = "/getPileList", method = RequestMethod.GET)
    public BikeResult getPileList(@RequestParam(value = "stationId")String stationId) {
        return orderService.getPileList(stationId);
    }

    @ApiOperation(value="获取网点", notes="获取网点")
    @RequestMapping(value = "/getByStationId", method = RequestMethod.GET)
    public BikeResult getByStationId(@RequestParam(value = "id")String id) {
        return orderService.getByStationId(id);
    }

    @ApiOperation(value="根据权限和编码获取网点地图", notes="根据权限和编码获取网点地图")
    @RequestMapping(value = "/getByStationCode", method = RequestMethod.GET)
    public BikeResult getByStationCode(@RequestParam(value = "code",required = false)String code,HttpServletRequest request) {
        return orderService.getByStationCode(code,request) ;
    }

    @ApiOperation(value="获取车桩信息", notes="获取车桩信息")
    @RequestMapping(value = "/getPileById", method = RequestMethod.GET)
    public BikeResult getPileById(@RequestParam(value = "id")String id,@RequestParam(value = "stationId")String stationId) {
        return orderService.getPileById(id,stationId);
    }

    @ApiOperation(value="修改车桩信息", notes="修改车桩信息")
    @RequestMapping(value = "/updateStation", method = RequestMethod.POST)
    public BikeResult updateStation(@RequestBody StationReq stationReq) {
        return orderService.updateStation(stationReq);
    }
}
